package book;

public class Book {
    private  String name; //书名
    private String  author; //作者
    private int price;//价格
    private  String type;//类型
    private boolean isBorrowed;//是否借出

    //没有isBorrowed的get,set方法，
    // 因为成员变量没有初始化的时候会有一个默认值
    //boolean 默认是false，因为一本书拿过来默认就是未被借出的
    //所以不用给isBorrowed初始化
    //构造方法可以不用写它
    public Book(String name, String author, int price, String type) {
        this.name = name;
        this.author = author;
        this.price = price;
        this.type = type;
    }

    public boolean isBorrowed() {
        return isBorrowed;
    }

    public void setBorrowed(boolean borrowed) {
        isBorrowed = borrowed;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Override
    public String toString() {
        return "Book{" +
                "name='" + name + '\'' +
                ", author='" + author + '\'' +
                ", price=" + price +
                ", type='" + type + '\'' +
                ", isBorrowed=" + isBorrowed +
                '}';
    }
}
